﻿using Model;
using Newtonsoft.Json;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Net;
using System.Net.Http;
using System.Web;
using System.Web.Http;
using SYT.AliApiHandle;
using SYT.AliApiHandle.SubmitToAli;

namespace SYT.Web.WebApi
{
    public class TitleUpdateController : ApiController
    {
        // GET api/<controller>
        public IEnumerable<string> Get()
        {
            return new string[] { "value1", "value2" };
        }

        // GET api/<controller>/5
        public string Get(int id)
        {
            return "value";
        }

        // POST api/<controller>
        public string UpdateTitl()
        {
            string offerId = HttpContext.Current.Request["offerId"];
            string subject = HttpContext.Current.Request["subject"];

            Users user = JsonConvert.DeserializeObject<Users>(HttpContext.Current.Session["UserreAllInfo"].ToString());

            return SubmitUpdateToAli.UpdateTitle(offerId, subject, user.access_token);
        }

        // PUT api/<controller>/5
        public void Put(int id, [FromBody]string value)
        {

        }

        // DELETE api/<controller>/5
        public void Delete(int id)
        {

        }
    }
}